<html>
<head>
    <title>成绩单</title>
    <meta charset="UTF-8">
</head>
<style>
    body {
        background-image: url("/登录界面/WOW.jpg");
    }

    table {
        color: #00ee00;
    }

    div {
        color: #00ee00;

    }

    .main {
        margin-top: 150px;
    }
</style>
<body>
<div class="main">
    <form method="post">
        <table width="500" border="5" align="center">
            <tr>
                <th colspan="2">判断成绩</th>
            </tr>
            <tr>
                <td>语文:</td>
                <td><input name="chinese" type="text" id="chinese"/></td>
            </tr>
            <tr>
                <td>数学:</td>
                <td><input name="math" type="text" id="math"/></td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="submit" value="提交" name="button" id="button"/>
                </td>
            </tr>
        </table>
    </form>
</div>
<div>
    <?php
    //    $num=7;
    //    switch ($num%3){
    //        case 1:
    //        echo '渣男林';
    //        break;
    //        case 2:
    //            echo '林渣男';
    //        default :
    //            echo '都是张林';
    //    }

    if (isset($_POST['button'])) {
        $chinese = $_POST['chinese'];
        $math = $_POST['math'];

        if ($chinese == '' || !is_numeric($chinese) || $chinese > 100 || $chinese < 0) {
            echo '语文成绩不符合要求';
        } elseif ($math == '' || !is_numeric($math) || $math > 100 || $math < 0) {
            echo '数学成绩不符合要求';
        } else {
            $a = ($chinese + $math) / 2;
            echo "平均值为:" . $a;
            echo '<br/>';

            switch ((int)($a / 10)) {
                case 9:
                    echo '放假';
                    break;
                case 8:
                    echo '不惩罚';
                    break;
                case 7:
                    echo '一点惩罚';
                    break;
                case 6:
                    echo '惩罚打渣男林';
                    break;
                default:
                    echo '不及格';
                    break;
            }
        }
    }
    ?>
</div>
</body>
</html>
